import 'package:flutter/cupertino.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:gczn_hd/app/core/base/handle_mixin.dart';
import 'package:gczn_hd/app/core/values/App_img.dart';
import 'package:gczn_hd/app/routes/app_pages.dart';
import 'package:get/get.dart';

class MiddleMenu extends StatelessWidget with HandleMixin{

  final Size picSize = const Size(522, 330);

  @override
  Widget build(BuildContext context) {

    return Container(
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceAround,
        children: [
          _buildItem(imgPic: AppImg.productionCtation, name: "生产工位"),
          _buildItem(imgPic: AppImg.devicePpotCheck, name: "设备点检"),
          _buildItem(imgPic: AppImg.sopFile, name: "Sop文件"),
        ],
      ),
    );
  }

  Widget _buildItem({required String imgPic, String name = ""}){

    return GestureDetector(
      onTap: (){
        if( name == '生产工位' ){
          Get.toNamed(Routes.STATION);
        } else if( name == 'Sop文件' ){
          Get.toNamed(Routes.SOP_FILE);
        }else if( name == '设备点检' ){
          Get.toNamed(Routes.SPOTCHECK);
        }else{
          showToast(name);
        }
      },
      child: Container(
        child: Image.asset(imgPic, width: picSize.width.w, height: picSize.height.h,),
      ),
    );
  }

}